import request from '@/utils/request'

// 查询会员类型列表
export function getMemberType(query) {
  return request({
    url: '/memberUser/getMemberUser',
    method: 'get',
    params: query
  })
}

// 查询会员类型列表
export function getMemberLists(venueUniqueIdentifier) {
  return request({
    url: '/memberUser/getMemberList/' + venueUniqueIdentifier,
    method: 'get',
  })
}

// 新增用户详细
export function addMember(data) {
  return request({
    url: '/memberUser/addMember',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

// 通过id查询单个数据
export function getById(id, venueUniqueIdentifier) {
  const data = {
    id,
    venueUniqueIdentifier
  }
  return request({
    url: '/memberUser/getById',
    method: 'put',
    data: data
  })
}

// 修改会员类型
export function updateMemberById(data) {
  return request({
    url: '/memberUser/updateMemberById',
    method: 'put',
    data: data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

export function userIfEntrance(formData) {
  return request({
    url: '/memberUser/userIfEntrance',
    method: 'post',
    data: formData
  })
}


// 通过id查询单个数据
export function getByInvitationCode(invitationCode, venueUniqueIdentifier) {
  const data = {
    invitationCode,
    venueUniqueIdentifier
  }
  return request({
    url: '/memberUser/getByInvitationCode',
    method: 'put',
    data: data
  })
}

export function deleteNumberTimes(memberUserPhone, venueUniqueIdentifier) {
  const data = {
    memberUserPhone,
    venueUniqueIdentifier
  }
  return request({
    url: '/memberUser/deleteNumberTimes',
    method: 'put',
    data: data
  })
}

export function selectUserInfoByNumid(venueUniqueIdentifier, membershipCardNumber) {
  return request({
    url: '/memberUser/selectUserInfoByNumid',
    method: 'get',
    params: {
      venueUniqueIdentifier,
      membershipCardNumber
    }
  })
}

export function selectOnlineStatuss(venueUniqueIdentifier) {
  console.log(venueUniqueIdentifier)
  return request({
    url: '/memberUser/onlineNumber/' + venueUniqueIdentifier,
    method: 'get',
  })
}

export function selectEntranceNumbers(venueUniqueIdentifier, currentDate) {
  console.log(venueUniqueIdentifier, currentDate)
  return request({
    url: '/memberUser/selectEntranceNumber',
    method: 'get',
    params: {
      venueUniqueIdentifier,
      currentDate
    }
  })
}

export function intoVenuById(id, venueUniqueIdentifier) {
  return request({
    url: '/memberUser/intoVenuById',
    method: 'get',
    params: {
      id,
      venueUniqueIdentifier
    }
  })
}

export function outVenuById(id, venueUniqueIdentifier) {
  return request({
    url: '/memberUser/outVenuById',
    method: 'get',
    params: {
      id,
      venueUniqueIdentifier
    }
  })
}
